<script setup lang="ts">
// 这里写ts代码
import { ref } from 'vue'
// const count = ref(0)
// count.value = 123
// 1、简单数据 类型推导
const count = ref(0)
count.value = 123
// count.value = '123'

// 2、复杂类型 泛型函数
const year = ref<string | number>('2022')
year.value = 123

// 3、练习
type Item = {
  id: string,
  name: string,
  price: number
}

const goods = ref<Item[]>([])
goods.value = [
  {
    id: '1001',
    name: '男士鞋子',
    price: 100
  }
]

</script>

<template>
  <div>
    开始写vue+ts咯
    <ul>
      <li v-for="item in goods" :key="item.id">
      {{ item.name }}</li>
    </ul>
  </div>
</template>

<style scoped>

</style>
